<?php

class minify_handler {
	public function __construct($m) {
		if ( !isset($_GET['js_file']) || strstr($_GET['js_file'], '..') ) exit;
		
		$path = $m->Get('js_directory') . $_GET['js_file'];

		if ( file_exists(($path)) ) {
			$js = file_get_contents($path);
			$jsp = $m->GetObject('JavaScriptPacker', $js, 0);
			echo $jsp->pack();
		}
		/*if ( !isset($_GET['css_file']) || strstr($_GET['css_file'], '..') ) exit;
		
		$path = $m->Get('css_directory') . $_GET['css_file'];

		if ( file_exists(($path)) ) {
			$css = file_get_contents($path);
			$m->IncludeClass('Minify_CSS_Compressor');
			echo Minify_CSS_Compressor::process($css);
		}*/
	}
}
